#ifndef BASE_CTTYPE_H_
#define BASE_CTTYPE_H_
#include <vector>
#include <strings.h>
#include <string.h>
#include "ct_mutex.h"
#include "command.h"


// 定义长度宏
#define MAX_FRIEND_NUM		3000

// 定义指针删除操作
#ifndef SAFE_DELETE
#define SAFE_DELETE(x) {if((x) != NULL){delete (x); (x) = NULL;}}
#endif
#ifndef SAFE_DELETE_VEC
#define SAFE_DELETE_VEC(x) { if (NULL != (x)) { delete [] (x); (x) = NULL; } }
#endif


// 手动调用构造函数，不分配内存
        template<class _T1> 
inline  void constructInPlace(_T1  *_Ptr)
{
        new (static_cast<void*>(_Ptr)) _T1();
}
// 声明变长指令
#define BUFFER_CMD(cmd,name,len) char buffer##name[len];\
        bzero(buffer##name, len); \
cmd *name=(cmd *)buffer##name;constructInPlace(name);

// 定义服务器类型
enum {
        SUPERSERVER	        = 1,
        GATEWAYSERVER	        = 2,
        SESSIONSERVER	        = 3,
        LOGINSERVER	        = 4,
        LOGINVERIFYSERVER       = 5,
        ROOMSERVER	        = 6,
        RECORDSERVER	        = 7,
        ROOMSUPERSERVER	        = 8,
        ROOMGATEWAYSERVER       = 9,
        ROOMRECORDSERVER        = 10,
        OFFLINEMSGSERVER        = 11,
        SEARCHSERVER            = 12,
        ROOMMEDIASERVER         = 13,
        MONITORSERVER           = 14,
        REDISADAPTERSERVER      = 15,
        ROOMCACHESERVER         = 16,
        P2PVOICESERVER          = 17,
        NOTICESERVER            = 18,
        OPENCLASSSERVER         = 19,
        ROOMASSISTANTSERVER     = 20,
        DISCUSSSERVER           = 21,
        DISCUSSFACTORYSERVER    = 22,
        HISTORYMSGSERVER        = 23,
        GROUPFACTORYSERVER      = 24,
        GROUPSERVER             = 25,
        ROOMFLOWERSERVER        = 26,
        LOGINGATEWAYSERVER      = 27,
        MEDIARECORDSERVER       = 28,
        UNREGISTEREDSERVER      = 29,
        ECHOSERVER              = 30,
        MSGPUSHSERVER           = 31,
		MCUSERVER				= 32,
};

enum eBuddyFlag {
        eBuddyFlag_Normal = 0,		//接收好友请求
        eBuddyFlag_NotBeAdd,		//不接收好友请求
};

enum eNetType {
        eNetType_SHDX = 0,              //上海电信
        eNetType_SHLT = 1,              //上海联通
        eNetType_NBDX = 2,              //宁波电信
        eNetType_NBLT = 3,              //宁波联通
        eNetType_BJBGP = 4,             //北京BGP
};

enum eIDCType {
        eIDCType_center = 0,            //中心机房
        eIDCType_dianxin,               //电信机房
        eIDCType_liantong,              //联通机房
        eIDCType_bgp,                   //BGP机房
};

enum eISPType {
        ISP_UNKNOWN = 0,        // 未知, 可能是小运营商
        ISP_CTC = 1,            // 中国电信
        ISP_CNC = 2,            // 中国联通
        ISP_CMB = 3,            // 中国移动
        ISP_HKS = 4,            // 香港运营商
};

enum eGEOType {
        GEO_UNKNOWN = 0,        // 未知区域
};

#endif //BASE_CTTYPE_H_

